package com.pratik.gedcom;

import java.io.File;
import java.io.FileNotFoundException;

import com.pratik.gedcom.builder.implementation.GedcomBuilderImplementation;
import com.pratik.gedcom.fileutil.implementation.GedcomeFileUtilsImplementation;
import com.pratik.gedcom.mapper.TokenToGedcomMapper;
import com.pratik.gedcom.parser.impl.GedcomParserImplemetation;

/**
 * Hello world!
 *
 */
public class App 
{
    public static void main( String[] args ) throws FileNotFoundException
    {
        GedcomToXmlFileConvertor gedcomToXmlFileConvertor = initialize();
        File gedcomFile=new File("C:/gedcom.txt");
		gedcomToXmlFileConvertor.covertToXMLFile(gedcomFile, "c:/gedcome.xml");
		System.out.println("Success");
    }

	private static GedcomToXmlFileConvertor initialize() {
		GedcomToXmlFileConvertor gedcomToXmlFileConvertor=new GedcomToXmlFileConvertor();
        GedcomParserImplemetation gedcomeParser = new GedcomParserImplemetation();
        GedcomBuilderImplementation gedcomBuilder = new GedcomBuilderImplementation();
        gedcomBuilder.setGedcomeMapper(new TokenToGedcomMapper());
		gedcomeParser.setGedcomBuilder(gedcomBuilder);
        GedcomeFileUtilsImplementation gedcomFileUtil = new GedcomeFileUtilsImplementation();
		gedcomeParser.setGedcomFileUtil(gedcomFileUtil);
		gedcomToXmlFileConvertor.setGedcomParser(gedcomeParser);
		return gedcomToXmlFileConvertor;
	}
}
